const getDefaultState = () => {
  return {
    activeMenu: {
      id: "",
      path: ""
    },
    routePaths: [],
    menuCollapsed: false,
    paramRouteMap: {}
  };
};
export default {
  state: getDefaultState(),
  mutations: {
    RESETSESSIONSTATE(state) {
      state = Object.assign(state, getDefaultState());
    },
    SETACTIVEMENU: (state, data) => {
      state.activeMenu = data;
    },
    SETROUTEPATHS(state, data) {
      state.routePaths = data;
    },
    SETMENUCOLLSPSED: (state, menuCollapsed) => {
      state.menuCollapsed = menuCollapsed;
    },
    SETPARAMROUTEMAP: (state, route) => {
      state.paramRouteMap[route.id] = {
        params: route.params,
        query: route.query
      };
      console.log(state.paramRouteMap);
    }
  },
  actions: {
    setActiveMenu({ commit }, data) {
      commit("SETACTIVEMENU", data);
    },
    setRoutePaths({ commit }, data) {
      commit("SETROUTEPATHS", data);
    },
    setMenuCollapsed({ commit }, menuCollapsed) {
      commit("SETMENUCOLLSPSED", menuCollapsed);
    },
    setParamRouteMap({ commit }, route) {
      commit("SETPARAMROUTEMAP", route);
    }
  }
};
